home *** CD-ROM | disk | FTP | other *** search
- #==============================================================================
- # light.test
- #------------------------------------------------------------------------------
- # Test of the Tcl SIPP light commands.
- #------------------------------------------------------------------------------
- # Copyright 1992 Mark Diekhans
- # Permission to use, copy, modify, and distribute this software and its
- # documentation for any purpose and without fee is hereby granted, provided
- # that the above copyright notice appear in all copies. Mark Diekhans makes
- # no representations about the suitability of this software for any purpose.
- # It is provided "as is" without express or implied warranty.
- #------------------------------------------------------------------------------
- # $Id: light.test,v 2.0 1992/11/02 03:55:53 markd Rel $
- #==============================================================================
-
- if {[info procs test] == ""} {source testprocs.tcl}
-
- #
- # Test SippLightSourceCreate command.
- #
-
- test {light-1.1} {
- SippLightSourceCreate
- } 1 {wrong # args: SippLightSourceCreate {x y z} color type}
-
- test {light-1.2} {
- SippLightSourceCreate {1 3 4} {1.0 1 1} POINT BAZ
- } 1 {wrong # args: SippLightSourceCreate {x y z} color type}
-
- test {light-1.3} {
- SippLightSourceCreate {1 3 4} {1.0 1 xx} POINT
- } 1 {expected floating-point number but got "xx"}
-
- test {light-1.4} {
- SippLightSourceCreate {1 x 4} {1.0 .4 1} POINT
- } 1 {expected floating-point number but got "x"}
-
- test {light-1.5} {
- SippLightSourceCreate {1 3 4} {1.0 2 1} POINT
- } 1 {Expected a number in the range 0..1, got: 2}
-
- test {light-1.6} {
- SippLightSourceCreate {1 3 4} {1.0 2 1} SPUD
- } 1 {Expected a number in the range 0..1, got: 2}
-
- test {light-1.7} {
- set lightsource1 [SippLightSourceCreate {1 3 4} {1.0 1 1} POINT]
- crange $lightsource1 0 4
- } 0 {light}
-
- test {light-1.8} {
- set lightsource2 [SippLightSourceCreate {1 3 4} {0 .9 1} DIRECTION]
- crange $lightsource2 0 4
- } 0 {light}
-
- #
- # Test SippSpotLightCreate command.
- #
-
- test {light-2.1} {
- SippSpotLightCreate
- } 1 {wrong # args: SippSpotLightCreate position point opening color type shadow}
-
- test {light-2.2} {
- SippSpotLightCreate {1 3 4} {4 3 2} 20 {1.0 1 .1} SHARP true 0
- } 1 {wrong # args: SippSpotLightCreate position point opening color type shadow}
-
- test {light-2.3} {
- SippSpotLightCreate {1 3 4} {4 3 2} 20 {1.0 1 xx} SHARP true
- } 1 {expected floating-point number but got "xx"}
-
- test {light-2.4} {
- SippSpotLightCreate {1 3 4} {4 3 2} 20 {1.0 1 1.11} SHARP true
- } 1 {Expected a number in the range 0..1, got: 1.11}
-
- test {light-2.5} {
- SippSpotLightCreate {1 3 4} {4 3 2} 20 {1 .5 1} SPAM true
- } 1 {expected one of "SHARP" or "SOFT", got "SPAM"}
-
- test {light-2.6} {
- SippSpotLightCreate {1 3 4} {4 3 2} 20 {1.0 1} SHARP foo
- } 1 {color must be a list of three elements}
-
- test {light-2.7} {
- SippSpotLightCreate {1 3 4} {4 3 2} X20 {1.0 1} SHARP foo
- } 1 {expected floating-point number but got "X20"}
-
- test {light-2.8} {
- set spotlight1 [SippSpotLightCreate {1 3 4} {4 3 2} D20 {1.0 1 .1} SHARP true]
- crange $spotlight1 0 4
- } 0 {light}
-
- test {light-2.9} {
- set spotlight2 [SippSpotLightCreate {1 3 4} {4 3 2} R40 {1.0 1 .1} SOFT false]
- crange $spotlight1 0 4
- } 0 {light}
-
- #
- # Test SippLightSourcePut command.
- #
-
- test {light-3.1} {
- SippLightSourcePut
- } 1 {wrong # args: SippLightSourcePut light {x y z}}
-
- test {light-3.2} {
- SippLightSourcePut $lightsource1 {1 2 3} 4
- } 1 {wrong # args: SippLightSourcePut light {x y z}}
-
- test {light-3.3} {
- SippLightSourcePut $lightsource1 {1 x 3}
- } 1 {expected floating-point number but got "x"}
-
- test {light-3.4} {
- SippLightSourcePut $spotlight1 {1 1 3}
- } 1 {operation not valid on spotlights}
-
- test {light-3.5} {
- SippLightSourcePut $lightsource1 {1 1 3}
- } 0 {}
-
- #
- # Test SippSpotLightPos command.
- #
-
- test {light-4.1} {
- SippSpotLightPos
- } 1 {wrong # args: SippSpotLightPos light {x y z}}
-
- test {light-4.2} {
- SippSpotLightPos $spotlight1 {1 2 3} 4
- } 1 {wrong # args: SippSpotLightPos light {x y z}}
-
- test {light-4.3} {
- SippSpotLightPos $spotlight1 {1 x 3}
- } 1 {expected floating-point number but got "x"}
-
- test {light-4.4} {
- SippSpotLightPos $lightsource1 {1 2 3}
- } 1 {operation not valid on lightsources}
-
- test {light-4.4} {
- SippSpotLightPos $spotlight1 {1 2 3}
- } 0 {}
-
- #
- # Test SippSpotLightShadows command.
- #
-
- test {light-5.1} {
- SippSpotLightShadows
- } 1 {wrong # args: SippSpotLightShadows light flag}
-
- test {light-5.2} {
- SippSpotLightShadows $spotlight1 true 1
- } 1 {wrong # args: SippSpotLightShadows light flag}
-
- test {light-5.3} {
- SippSpotLightShadows $spotlight1 foo
- } 1 {expected boolean value but got "foo"}
-
- test {light-5.4} {
- SippSpotLightShadows $lightsource1 true
- } 1 {operation not valid on lightsources}
-
- test {light-5.6} {
- SippSpotLightShadows $spotlight1 true
- } 0 {}
-
- test {light-5.7} {
- SippSpotLightShadows $spotlight1 false
- } 0 {}
-
- #
- # Test SippLightColor command.
- #
-
- test {light-6.1} {
- SippLightColor
- } 1 {wrong # args: SippLightColor light color}
-
- test {light-6.2} {
- SippLightColor $spotlight1 {0 1 xx}
- } 1 {expected floating-point number but got "xx"}
-
- test {light-6.3} {
- SippLightColor $lightsource1 {0 2 0}
- } 1 {Expected a number in the range 0..1, got: 2}
-
- test {light-6.4} {
- SippLightColor $lightsource1 {0 1 .6}
- } 0 {}
-
- test {light-6.5} {
- SippLightColor $spotlight1 {0 1 .6}
- } 0 {}
-
- #
- # Test SippLightActive command.
- #
-
- test {light-7.1} {
- SippLightActive
- } 1 {wrong # args: SippLightActive light flag}
-
- test {light-7.2} {
- SippLightActive $spotlight1 true 1
- } 1 {wrong # args: SippLightActive light flag}
-
- test {light-7.3} {
- SippLightActive $lightsource1 foo
- } 1 {expected boolean value but got "foo"}
-
- test {light-7.4} {
- SippLightActive $lightsource1 true
- } 0 {}
-
- test {light-7.5} {
- SippLightActive $lightsource1 false
- } 0 {}
-
- test {light-7.6} {
- SippLightActive $spotlight1 true
- } 0 {}
-
- test {light-7.7} {
- SippLightActive $spotlight1 false
- } 0 {}
-
-
- #
- # Test SippLightDestruct command.
- #
-
- test {light-8.1} {
- SippLightDestruct
- } 1 {wrong # args: SippLightDestruct lightlist}
-
- test {light-8.2} {
- SippLightDestruct $lightsource1 $spotlight1
- } 1 {wrong # args: SippLightDestruct lightlist}
-
- test {light-8.3} {
- SippLightDestruct $lightsource1 foo
- } 1 {wrong # args: SippLightDestruct lightlist}
-
- test {light-8.4} {
- list [catch {SippLightDestruct [list $lightsource1 $lightsource1]} msg] \
- [crange $msg 0 30]
- } 0 {1 {duplicate handle in list: light}}
-
- test {light-8.5} {
- SippLightDestruct $lightsource1
- } 0 {}
-
- test {light-8.6} {
- SippLightDestruct $spotlight1
- } 0 {}
-
- test {light-8.7} {
- SippLightDestruct [list $spotlight2 $lightsource2]
- } 0 {}
-
-